#include<stdio.h>

int main()
{
	int m, n;
	scanf_s("%d %d", &m, &n);
	int b = (n - m * 2) / 2;
	int a = m - b;
	if (b < 0 || a < 0 || (2 * a + 4 * b != n || (a + b) != m))
	{
		printf("-1 -1\n");
	}
	else
	{
		printf("%d %d", a, b);
	}
	return 0;
}